package com.thoughtworks.tax;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * define the receipt
 * @author tony
 *
 */
public class Receipt
{

	private List<Item>	items			= new ArrayList<Item>();
	private BigDecimal	totalPrice		= new BigDecimal("0");
	private BigDecimal	totalTaxAmount	= new BigDecimal("0");

	/**
	 * print the receipt type
	 */
	public void print()
	{
		for (Item item : items)
		{
			System.out.println(item);
		}

	}

	public void addItem(Item item)
	{
		items.add(item);
		totalPrice = totalPrice.add(item.getPrice()).add(item.getTaxedAmount().multiply(item.getAccount()));
		totalTaxAmount = totalTaxAmount.add(item.getTaxedAmount());
	}

	public BigDecimal getTotalPrice()
	{
		return totalPrice;
	}

	public BigDecimal getTotalTaxAmount()
	{
		return totalTaxAmount;
	}

}
